\(\int \frac {\tan ^2(c+d x)}{a+a \sin (c+d x)} \, dx\) [774]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 21, antiderivative size = 50 \[ \int \frac {\tan ^2(c+d x)}{a+a \sin (c+d x)} \, dx=\frac {\sec (c+d x)}{a d}-\frac {\sec ^3(c+d x)}{3 a d}+\frac {\tan ^3(c+d x)}{3 a d} \]

[Out]

sec(d*x+c)/a/d-1/3*sec(d*x+c)^3/a/d+1/3*tan(d*x+c)^3/a/d

Rubi [A] (verified)

Time = 0.08 (sec) , antiderivative size = 50, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.190, Rules used = {2785, 2687, 30, 2686} \[ \int \frac {\tan ^2(c+d x)}{a+a \sin (c+d x)} \, dx=\frac {\tan ^3(c+d x)}{3 a d}-\frac {\sec ^3(c+d x)}{3 a d}+\frac {\sec (c+d x)}{a d} \]

[In]

Int[Tan[c + d*x]^2/(a + a*Sin[c + d*x]),x]

[Out]

Sec[c + d*x]/(a*d) - Sec[c + d*x]^3/(3*a*d) + Tan[c + d*x]^3/(3*a*d)

Rule 30

Int[(x_)^(m_.), x_Symbol] :> Simp[x^(m + 1)/(m + 1), x] /; FreeQ[m, x] && NeQ[m, -1]

Rule 2686

Int[((a_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[a/f, Subst[
Int[(a*x)^(m - 1)*(-1 + x^2)^((n - 1)/2), x], x, Sec[e + f*x]], x] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n -
1)/2] &&  !(IntegerQ[m/2] && LtQ[0, m, n + 1])

Rule 2687

Int[sec[(e_.) + (f_.)*(x_)]^(m_)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[1/f, Subst[Int[(b*x)
^n*(1 + x^2)^(m/2 - 1), x], x, Tan[e + f*x]], x] /; FreeQ[{b, e, f, n}, x] && IntegerQ[m/2] &&  !(IntegerQ[(n
- 1)/2] && LtQ[0, n, m - 1])

Rule 2785

Int[((g_.)*tan[(e_.) + (f_.)*(x_)])^(p_.)/((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Dist[1/a, Int[S
ec[e + f*x]^2*(g*Tan[e + f*x])^p, x], x] - Dist[1/(b*g), Int[Sec[e + f*x]*(g*Tan[e + f*x])^(p + 1), x], x] /;
FreeQ[{a, b, e, f, g, p}, x] && EqQ[a^2 - b^2, 0] && NeQ[p, -1]

Rubi steps \begin{align*} \text {integral}& = \frac {\int \sec ^2(c+d x) \tan ^2(c+d x) \, dx}{a}-\frac {\int \sec (c+d x) \tan ^3(c+d x) \, dx}{a} \\ & = \frac {\text {Subst}\left (\int x^2 \, dx,x,\tan (c+d x)\right )}{a d}-\frac {\text {Subst}\left (\int \left (-1+x^2\right ) \, dx,x,\sec (c+d x)\right )}{a d} \\ & = \frac {\sec (c+d x)}{a d}-\frac {\sec ^3(c+d x)}{3 a d}+\frac {\tan ^3(c+d x)}{3 a d} \\ \end{align*}

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(106\) vs. \(2(50)=100\).

Time = 0.07 (sec) , antiderivative size = 106, normalized size of antiderivative = 2.12 \[ \int \frac {\tan ^2(c+d x)}{a+a \sin (c+d x)} \, dx=\frac {6-10 \cos (c+d x)+2 \cos (2 (c+d x))+8 \sin (c+d x)-5 \sin (2 (c+d x))}{12 a d \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right ) \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right ) (1+\sin (c+d x))} \]

[In]

Integrate[Tan[c + d*x]^2/(a + a*Sin[c + d*x]),x]

[Out]

(6 - 10*Cos[c + d*x] + 2*Cos[2*(c + d*x)] + 8*Sin[c + d*x] - 5*Sin[2*(c + d*x)])/(12*a*d*(Cos[(c + d*x)/2] - S
in[(c + d*x)/2])*(Cos[(c + d*x)/2] + Sin[(c + d*x)/2])*(1 + Sin[c + d*x]))

Maple [A] (verified)

Time = 0.16 (sec) , antiderivative size = 48, normalized size of antiderivative = 0.96

method result size
parallelrisch \(\frac {-4-8 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{3 d a \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{3}}\) \(48\)
norman \(\frac {-\frac {4}{3 a d}-\frac {8 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{3 d a}}{\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{3} \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}\) \(54\)
derivativedivides \(\frac {-\frac {1}{2 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}-\frac {2}{3 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{3}}+\frac {1}{\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{2}}+\frac {8}{16 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+16}}{d a}\) \(70\)
default \(\frac {-\frac {1}{2 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}-\frac {2}{3 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{3}}+\frac {1}{\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{2}}+\frac {8}{16 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+16}}{d a}\) \(70\)
risch \(\frac {2 i {\mathrm e}^{2 i \left (d x +c \right )}+2 \,{\mathrm e}^{3 i \left (d x +c \right )}+\frac {2 i}{3}-\frac {2 \,{\mathrm e}^{i \left (d x +c \right )}}{3}}{\left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )^{3} d a}\) \(74\)

[In]

int(sec(d*x+c)^2*sin(d*x+c)^2/(a+a*sin(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

1/3*(-4-8*tan(1/2*d*x+1/2*c))/d/a/(tan(1/2*d*x+1/2*c)-1)/(tan(1/2*d*x+1/2*c)+1)^3

Fricas [A] (verification not implemented)

none

Time = 0.24 (sec) , antiderivative size = 47, normalized size of antiderivative = 0.94 \[ \int \frac {\tan ^2(c+d x)}{a+a \sin (c+d x)} \, dx=\frac {\cos \left (d x + c\right )^{2} + 2 \, \sin \left (d x + c\right ) + 1}{3 \, {\left (a d \cos \left (d x + c\right ) \sin \left (d x + c\right ) + a d \cos \left (d x + c\right )\right )}} \]

[In]

integrate(sec(d*x+c)^2*sin(d*x+c)^2/(a+a*sin(d*x+c)),x, algorithm="fricas")

[Out]

1/3*(cos(d*x + c)^2 + 2*sin(d*x + c) + 1)/(a*d*cos(d*x + c)*sin(d*x + c) + a*d*cos(d*x + c))

Sympy [F]

\[ \int \frac {\tan ^2(c+d x)}{a+a \sin (c+d x)} \, dx=\frac {\int \frac {\sin ^{2}{\left (c + d x \right )} \sec ^{2}{\left (c + d x \right )}}{\sin {\left (c + d x \right )} + 1}\, dx}{a} \]

[In]

integrate(sec(d*x+c)**2*sin(d*x+c)**2/(a+a*sin(d*x+c)),x)

[Out]

Integral(sin(c + d*x)**2*sec(c + d*x)**2/(sin(c + d*x) + 1), x)/a

Maxima [A] (verification not implemented)

none

Time = 0.21 (sec) , antiderivative size = 90, normalized size of antiderivative = 1.80 \[ \int \frac {\tan ^2(c+d x)}{a+a \sin (c+d x)} \, dx=\frac {4 \, {\left (\frac {2 \, \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + 1\right )}}{3 \, {\left (a + \frac {2 \, a \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - \frac {2 \, a \sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}} - \frac {a \sin \left (d x + c\right )^{4}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{4}}\right )} d} \]

[In]

integrate(sec(d*x+c)^2*sin(d*x+c)^2/(a+a*sin(d*x+c)),x, algorithm="maxima")

[Out]

4/3*(2*sin(d*x + c)/(cos(d*x + c) + 1) + 1)/((a + 2*a*sin(d*x + c)/(cos(d*x + c) + 1) - 2*a*sin(d*x + c)^3/(co
s(d*x + c) + 1)^3 - a*sin(d*x + c)^4/(cos(d*x + c) + 1)^4)*d)

Giac [A] (verification not implemented)

none

Time = 0.30 (sec) , antiderivative size = 68, normalized size of antiderivative = 1.36 \[ \int \frac {\tan ^2(c+d x)}{a+a \sin (c+d x)} \, dx=-\frac {\frac {3}{a {\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1\right )}} - \frac {3 \, \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 12 \, \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 5}{a {\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1\right )}^{3}}}{6 \, d} \]

[In]

integrate(sec(d*x+c)^2*sin(d*x+c)^2/(a+a*sin(d*x+c)),x, algorithm="giac")

[Out]

-1/6*(3/(a*(tan(1/2*d*x + 1/2*c) - 1)) - (3*tan(1/2*d*x + 1/2*c)^2 + 12*tan(1/2*d*x + 1/2*c) + 5)/(a*(tan(1/2*
d*x + 1/2*c) + 1)^3))/d

Mupad [B] (verification not implemented)

Time = 9.77 (sec) , antiderivative size = 47, normalized size of antiderivative = 0.94 \[ \int \frac {\tan ^2(c+d x)}{a+a \sin (c+d x)} \, dx=-\frac {4\,\left (2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )+1\right )}{3\,a\,d\,\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )-1\right )\,{\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )+1\right )}^3} \]

[In]

int(sin(c + d*x)^2/(cos(c + d*x)^2*(a + a*sin(c + d*x))),x)

[Out]

-(4*(2*tan(c/2 + (d*x)/2) + 1))/(3*a*d*(tan(c/2 + (d*x)/2) - 1)*(tan(c/2 + (d*x)/2) + 1)^3)